const postcss = require('postcss')

const getCssDep = (preCss) => {
    const dependencies = []
    const plugin = () => ({
        postcssPlugin: 'removeImport',
        AtRule: {
            import: (imp) => {
                dependencies.push(imp.params)
                imp.remove()
            }
        }
    });
    const res = postcss([plugin()])
        .process(preCss, { from: undefined, to: undefined })
    return {
        css: res.css,
        dependencies
    }

}
module.exports = {
    getCssDep
}